package com.ytxg.book.controller.api;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ytxg.api.po.book.BookComment;
import com.ytxg.api.po.book.BookInfo;
import com.ytxg.book.service.IBookInfoService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;
import java.util.List;

@RestController
public class BookRController {
    @Resource
    private IBookInfoService iBookInfoService;

    @PostMapping("api/in/get")
    public List<BookInfo> getBookInfoList(@RequestBody Collection<Long> bookIds){
        List<BookInfo> bookInfos = iBookInfoService.getBookByIds(bookIds);
        return bookInfos;
    }
    @PostMapping("api/in/getBookComment")
    public List<BookComment> getBookComment(Long userId, Integer pageNum, Integer pageSize){
        List<BookComment> bookComment = iBookInfoService.getBookComment(userId,pageNum,pageSize);
        return bookComment;
    }

    @PostMapping("/api/in/getBookInfoById")
    public BookInfo getBookInfoById(@RequestBody Long bookId){
        BookInfo bookInfoById = iBookInfoService.getById(bookId);
        return bookInfoById;
    }

}
